\section{Serial System}
\label{sec:mod:serial}

In the serial compressor system, the two compressors are arranged such that the discharge tank of the first compressor feeds into the suction tank of the second compressor, as shown in \fig{mod:serial}.
The pressure upstream of Compressor 1 as well as the pressure downstream of Compressor 2 are constrained to be at atmospheric pressure.
Furthermore, the inlet valve to Compressor 2 has been replaced by the outlet valve of Compressor 1. The state equations for this system are thus given by:

\begin{equation}
  \dt{}
  \ubrace{\begin{bmatrix}
    \gi{nominalstate}\\
    \gii{nominalstate}\\
  \end{bmatrix}}{\g{serialstate}} =
  \ubrace{\begin{bmatrix}
    \gi{nominalderiv}\\
    \gii{nominalderiv}
  \end{bmatrix}}{\g{serialderiv}},
  \label{eq:mod:serial-state-eq}
\end{equation}

\noindent where \g{serialstate} and \g{serialderiv} are the state vector and state derivative of the serial system, respectively, and the subscripts 1 and 2 refer to values for the first and second compressor, respectively, and the following constraints are applied representing the interconnection of the two compressors:

\begin{equation}
  \begin{split}
    \gi{pout} & = \gii{ps}\\
    \gii{pin} & = \gi{pd}\\
    \gii{gamma} & = \gi{epsilon}\\
    \gii{us} & = \gi{ud}.
  \end{split}
  \label{eq:mod:serial-constraints}
\end{equation}

The valve connecting the two compressors (controlled by \gi{ud}) is fixed at a fully open position in order to minimize pressure losses in the system.
The input vector used for control (\g{serialin}) contains the torque and recycle valve inputs for each of the two compressors:

\begin{equation}
  \g{serialin} = \begin{bmatrix} \gi{un} \\ \gii{un} \end{bmatrix}.
\end{equation}


\begin{figure}
  \centering
  \togglefalse{compleg}
  \togglefalse{complabel}
  \newdimen\xcoord
  \newdimen\ycoord
  \newdimen\xcoordb
  \newdimen\ycoordb

  \resizebox{\linewidth}{!}{%
    \begin{tikzpicture}
      \renewcommand{\glsgraphcmd}[1]{\glsentryuseri{#1}}
      % draw first compressor
      \drawcomp
      % \draw (current bounding box.south west) rectangle (current bounding box.north east);

      \togglefalse{compfirstvalve}

      \pgfgetlastxy{\xcoord}{\ycoord}
      \renewcommand{\glsgraphcmd}[1]{\glsentryuserii{#1}}

      % Draw second compressor shifted
      \begin{scope}[yscale=-1,xscale=1,shift={($(\xcoord,\ycoord) - (0.5*\tankdim,6.65)$)}]
        \drawcomp
      \end{scope}

      \pgfgetlastxy{\xcoordb}{\ycoordb}

    \end{tikzpicture}
  }
  \begin{tikzpicture}[overlay]
    \coordinate (origin) at (0.2,6.5);
    % Label compressors
    \node at ($(origin) - (3.1,0)$) {Compressor 1};
    \node at ($(origin) + (3.1,0)$) {Compressor 2};
    \node at ($(origin) + (6.2,-0.2)$) {\bctext{\glsgraph{pa}}};
    \node at ($(origin) - (6.0,-2.7)$) {\bctext{\glsgraph{pa}}};

    % Legend
    \drawlegend{($(origin)+(4.5,-4)$)}

  \end{tikzpicture}


  \caption[Diagram of serial compressor system.]{Diagram of serial compressor system with inputs and states labelled. \g{pa} represents atmospheric pressure.}
  \label{fig:mod:serial}
\end{figure}


The system outputs are given by:

\begin{equation}
  \g{serialout} =
  \begin{bmatrix}
    \gi{yn}\\
    \gii{yn}
  \end{bmatrix}
\end{equation}

\noindent where \g{serialout} gives the output vector for the serial system, and \gi{yn} and \gii{yn} are the output vectors of the upstream and downstream compressors, respectively.

